<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="../style/journal.css" type="text/css" />
<style type="text/css"><!--
.googleadsense {
	margin: 2px;
	padding: 0px;
//--></style><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-65008-1";
urchinTracker();
</script><title>Catalyst && favicon.ico</title>
</head>
<body>
<a href="index.html">Journal</a>(2005) | <a href="../blog/"><b>Blog</b></a>(2006) | <a href="http://www.fayland.org/cgi-bin/random_link.pl">RandomLink</a> | <a href="AboutFayland.html">WhoAmI</a> | <a href="LiveBookmark.html">LiveBookmark</a> | <a href="http://www.fayland.org/">HomePage</a>
<p><&lt;Previous: <a href="Catalyst_Session_Win32.html">Catalyst 在 Win32 下的 Session</a>&nbsp;&nbsp;>>Next: <a href="Catalyst_Overview.html">我对 Catalyst 的理解和介绍</a></p>
<h1>Catalyst && favicon.ico</h1>
<div class='content'>
<p>Category: <a href='Catalyst.html'>Catalyst</a> &nbsp; Keywords: <b>Catalyst favicon</b></p><h3>Update</h3>现在这个东西没用了。<a href="http://dev.catalyst.perl.org">Catalyst</a> 的 plugin 的 Static::Simple 会直接解决。<h3>原始文章</h3>我运行 server.pl 的时候，在 Firefox 里访问时总会碰到类如下面的东西：<br /><pre>[Fri Sep 30 00:52:22 2005] [catalyst] [debug] **********************************<br />[Fri Sep 30 00:52:22 2005] [catalyst] [debug] Arguments are "favicon.ico"<br />[Fri Sep 30 00:52:22 2005] [catalyst] [debug] "GET" request for "favicon.ico" from 172.29.13.189<br />[Fri Sep 30 00:52:22 2005] [catalyst] [info] Request took 0.009201s (108.684/s)<br />.=-----------------------------------------------------------------+----------=.<br />| Action                                                           | Time      |<br />|=-----------------------------------------------------------------+----------=|<br />| /begin                                                           | 0.000425s |<br />| /default                                                         | 0.000030s |<br />| /end                                                             | 0.000678s |<br />'=-----------------------------------------------------------------+----------='</pre>这些没什么用的。所以我就写了个模块把这个 request 去掉了。没什么大动作，就是个人要用。<p /><pre>package Catalyst::Plugin::NoFavIcon;<p />use strict;<br />use warnings;<br />use vars qw/$VERSION/;<br />use NEXT;<p />our $VERSION = '0.01';<p />sub prepare_action {<br />    my $c = shift;<br />    if ($c->req->path eq 'favicon.ico') {<br />     &nbsp; &nbsp;$c->res->status(404); # I don't know how to stop the process properly<br />     &nbsp; &nbsp;return;<br />    } else {<br />     &nbsp; &nbsp;return $c->NEXT::prepare_action(@_);<br />    }<br />}<p />1;</pre>用的时候就<br /><pre>use Catalyst qw/-Debug NoFavIcon/;</pre>与其他 plugin 没什么不同。<p />或许会将它打包到 CPAN, 等国庆回来再说吧。</div>
<p><&lt;Previous: <a href="Catalyst_Session_Win32.html">Catalyst 在 Win32 下的 Session</a>&nbsp;&nbsp;>>Next: <a href="Catalyst_Overview.html">我对 Catalyst 的理解和介绍</a></p>
<p><strong>Options:</strong> <a href='http://del.icio.us/post?title=Catalyst%20&&%20favicon.ico&url=http://www.fayland.org/journal/Catalyst_NoFavIcon.html'>+Del.icio.us</a></p>
<strong>Related items</strong>
<ul><li><a href='050328.html'>Catalyst & Eplanet</a> < <span class='digit'>2005-03-28 13:19:19</span> ></li><li><a href='050423.html'>Day [05.4.23] stay with me</a> < <span class='digit'>2005-04-23 16:17:02</span> ></li><li><a href='Catalyst_Authenticate.html'>Catalyst Authenticate</a> < <span class='digit'>2005-09-26 12:50:39</span> ></li><li><a href='Catalyst_Flaw.html'>Catalyst 的一个不足（一个已去掉）</a> < <span class='digit'>2005-09-27 13:44:31</span> ></li><li><a href='Catalyst_Session_Win32.html'>Catalyst 在 Win32 下的 Session</a> < <span class='digit'>2005-09-29 11:08:04</span> ></li><li><a href='Catalyst_Overview.html'>我对 Catalyst 的理解和介绍</a> < <span class='digit'>2005-10-08 01:39:40</span> ></li><li><a href='Catalyst_XMLRPC.html'>Catalyst && XML-RPC</a> < <span class='digit'>2005-10-11 21:50:30</span> ></li><li><a href='Catalyst_YAML.html'>Catalyst config YAML</a> < <span class='digit'>2005-12-10 12:50:39</span> ></li><li><a href='CatalystAdventCalendar_CN.html'>Catalyst Advent Calendar 中文版</a> < <span class='digit'>2005-12-15 23:28:40</span> ></li></ul>
Created on <span class="digit">2005-09-30 00:57:57</span>, Last modified on <span class="digit">2005-11-18 20:22:28</span><br />
Copyright 2004-2005 All Rights Reserved. Powered by <a href="Eplanet.html">Eplanet</a> && <a href='http://catalyst.perl.org'>Catalyst</a> 5.62.
</body>
</html>